﻿<Page x:Class="WpfViewBox.RockPanelWin"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="RockPanelWin" Height="303" Width="639">
    <DockPanel LastChildFill="True">
        <TextBlock  Text="1.Dock.Top" DockPanel.Dock="Top" Background="Bisque" Margin="0" Height="50"  VerticalAlignment="Top"/>
        <TextBlock  Text="2.Dock.Bottom" DockPanel.Dock="Bottom" Background="GreenYellow"   Margin="0" Height="20" VerticalAlignment="Bottom"/>
        <TextBlock  Text="3.Dock.Left" DockPanel.Dock="Left" Background="Tan"  Width="100"  />
        <Grid DockPanel.Dock="Right" x:Name="gridRight"  Width="200">
            <TextBlock  Text="4.Dock.Right" Background="Honeydew"    HorizontalAlignment="Stretch"/>
            <ToggleButton Content="->" Height="23" HorizontalAlignment="Left" Margin="0,50,0,0"  Name="btnRight" VerticalAlignment="Top" Width="23"  >
                <ToggleButton.Triggers>
                    <EventTrigger   RoutedEvent="ToggleButton.Checked">
                        <StopStoryboard BeginStoryboardName="collapsed" />
                        <BeginStoryboard x:Name="expand"   HandoffBehavior="SnapshotAndReplace">
                            <Storyboard  >
                                <DoubleAnimation      Duration="00:00:0.10 "  Storyboard.TargetName="gridRight" Storyboard.TargetProperty="Width" To="50" />
                                <ObjectAnimationUsingKeyFrames      Storyboard.TargetProperty="Content"   >
                                    <DiscreteObjectKeyFrame Value="-&gt;"  KeyTime="00:00:0.10" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                    <EventTrigger RoutedEvent="ToggleButton.Unchecked">
                        <StopStoryboard BeginStoryboardName="expand" />
                        <BeginStoryboard x:Name="collapsed"   HandoffBehavior="SnapshotAndReplace">
                            <Storyboard  >
                                <DoubleAnimation       Duration="00:00:0.10 "    Storyboard.TargetName="gridRight" Storyboard.TargetProperty="Width" To="200" />
                                <ObjectAnimationUsingKeyFrames      Storyboard.TargetProperty="Content"   >
                                    <DiscreteObjectKeyFrame Value="&lt;-"  KeyTime="00:00:0.10" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </ToggleButton.Triggers>
            </ToggleButton>
        </Grid>
        <TextBlock  Text="last" Background="Aquamarine" />
    </DockPanel>
</Page>
